package com.trendit.java_test;

public class CommuManager {

    private static CommuManager instance;
    private SocketCommu socketCommu;

    private CommuManager() {

    }

    public static CommuManager getInstance() {
        return instance;
    }

    public boolean createSocket(String address, int port) {
        socketCommu = new SocketCommu(address, port);
        return true;
    }

    public boolean setSSLRequest(boolean sslRequest) {
        if (socketCommu == null) {
            return false;
        }
        socketCommu.setSSLRequest(sslRequest);
        return true;
    }

    public boolean send(byte[] data) {
        return socketCommu.send(data);
    }

    public byte[] recv() {
        return socketCommu.recv();
    }

    public boolean close() {
        return socketCommu.close();
    }

}
